package com.baimo.support.commons.constants;

import com.baimo.support.utils.IdWorker;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by gsl on 2019/11/20.
 */
public interface Constants {
    //city为主键code为值
    Map<String,String> CITY_CODE = new HashMap<>();
    //code为主键city为值
    Map<String,String> CODE_CITY = new HashMap<>();

    IdWorker USER_GENERATOR = new IdWorker(1,2);
    IdWorker USER_SESSION_GENERATOR = new IdWorker(1,3);

    //全局参数
    interface Global{
        static final String ADMIN_LOGIN_SESSION_YES = "login_yes";
        static final String LOGIN_DES_CODE = "energyCode2017";
        static final String LOGIN_SESSION_AUTH = "auth";

        static final String RESPONSE_YES = "1";
        static final String RESPONSE_NO = "-1";
        String REMOTE_HEAD_AUTH = "TOKEN";
        String REMOTE_HEAD_MOBILE = "MOBILE";

        String SPEED_CARD = "1001";
        String DEF_CARD = "1002";
        String THIEF_CARD = "1003";

        int DEFAULT_V_CODE_LEN = 6;
        public interface Page {
            int DEFUALT_PAGE_SIZE = 10;
            int APP_PAGE_SIZE = 50;
            int TASK_PAGE_SIZE = 50;
        }
        //免过滤url
        final String[] UNTOKEN_URL = {
                "/account/mobileCodeLogin",
                "/account/logout",
                "/account/mobilePwdLogin",
                "/account/vargoAccountLogin",
                "/account/getValidateCode",
                "/account/getFindPasswordCode",
                "/account/checkResetPasswordCode",
                "/account/resetPassword",
                "/account/getFindPasswordCode",
                "/account/checkResetPasswordCode",
                "/account/resetPassword",
                "/router/setRouterTest"
        };
        interface Code{
            static final String ADMIN_INVALID_TOKEN_SESSION = "-2001";
            static final String SYSTEM_FAIL_EXIT = "-1000"; //系统错误
            static final String SYSTEM_BUSY = "-1001"; //无效的session
            static final String INVALID_TOKEN = "-1002";//权限错误
            static final String INVALID_PARAM = "-1003"; //参数错误
            interface Front{
                String AUTH_FAIL = "1001";
                String NONE_PROPS = "1002";
                String NONE_ENOUGH_ENERGY = "1003";
                String NONE_ENOUGH_ELECTRIC = "1004";
                String NONE_ENOUGH_COINS = "1005";
                String IS_ELECTRICING = "1006";
                String NOT_EXISTS_HANDLE = "1007";
                String HANDLE_IS_DISPOSE = "1008";
                String NONE_USEABLE_PROPS = "1009";
                String DEFEND_CARD_USING_NOT_REPEAT = "1010";
                String ELECTRIC_IS_FINISH_NOT_REPEAT = "1011";
                String NOT_FRIEND = "1012";
                String FRIEND_SITE_ENOUGH_IS_FULL = "1013";
                String USER_NOT_EXISTS = "1014";
                String SKIN_NOT_EXISTS = "1015";
                String IS_FRIEND = "1016";
                String EVERY_DAY_QUESTION_USE_UP = "1017";
                String THIEF_ENERGY_USE_IS_NOT_EXISTS = "1018";
                String ELECTRIC_CHARGE_NOT_TO_THIEF = "1019";
            }
        }
        //正则
        public interface Matches{
            public static String EMAIL_MATCHES = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
            public static String MOBILE_MATCHES = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
            public static String NUMBERS_MATCHES = "^-?\\d+$";
            public static String PASSWORF_MATCHS = "^[0-9a-zA-Z]{6,16}";
            public static String IS_NUMBER = "^[0-9]*$";
        }
        public enum Charset {
            UTF_8("utf-8", 1), GBK("gbk", 2), GB2312("gb2312", 3), ISO_8859_1(
                    "iso-8859-1", 4);
            // 成员变量
            private String name;
            private int index;

            // 构造方法
            private Charset(String name, int index) {
                this.name = name;
                this.index = index;
            }

            // 核心方法
            public static String getName(int index) {
                for (Charset c : Charset.values()) {
                    if (c.getIndex() == index) {
                        return c.name;
                    }
                }
                return null;
            }

            // get set 方法
            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public int getIndex() {
                return index;
            }

            public void setIndex(int index) {
                this.index = index;
            }
        }

    }
    interface HttpResponseCode{
        String RESPONSE_SUCC = "0";
        interface AdminLogin{
            String Admin_NAME_EMPTY = "1001";
            String Admin_PASSWORD_EMPTY = "1002";
            String Admin_NAME_OR_PASSWORD_FAIL = "1003";
        }
        interface Msg{
            String MSG_CONTENT_EMPTY = "2001";
            String MSG_ID_EMPTY = "2002";
        }
        interface AndroidCode{
            String USER_LOGIN_EMPTY = "9001";
        }
    }
}
